<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
class CreateUserGroupsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_groups', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->comment('用户ID');
            $table->integer('groups_id')->comment('群ID');
            $table->integer('group_msg_id')->comment('最后读取的群聊消息iD');
            $table->integer('is_master')->default(0)->comment('是否管理员,0不是，1是');
            $table->timestamps();
        });
        DB::statement("alter table `user_groups` comment'用户加入的群表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_groups');
    }
}
